@include('admin.header')

<style type="text/css">
  .opartion {
    width: 350px;
  }

  .pagination {
    list-style: none;
    float: right;
  }

  .pagination li {
    float: left;
    padding-left: 5px;
    padding-right: 5px;
  }

  .input_search {
    margin-top: 10px;
  }
</style>

<div class="wrap">
  <div class="margin-bottom-20">
    <!-- <a class="btn btn-primary edit"><i class="fa fa-plus"></i> 添加</a> -->
    {{ csrf_field() }}
    <input id="change_url" value="" type="hidden"/>
    <form action="{{url('capital/capital_flow')}}" method="post">
        <div class="cl pd-5 bg-1 bk-gray mt-20">
         转出者账户：
       <input type="text" style="width: 200px;height: 35px;" name="outownerid" value="{{$out_owner_id or ''}}"/>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       
       转出者类型：
        <select name="out_owner_type" style="width: 120px;">
          <option value=''>--请选择--</option>
          <option value='0_None'  @if($out_owner_type=='None'){echo selected="selected";} @endif>None</option>
          <option value='1_用户账户'  @if($out_owner_type=='用户账户'){echo selected="selected";} @endif>用户账户</option>
          <option value='2_商家账户'  @if($out_owner_type=='商家账户'){echo selected="selected";} @endif>商家账户</option>
          <option value='3_企业账户'  @if($out_owner_type=='企业账户'){echo selected="selected";} @endif>企业账户</option>
          <option value='99_系统账户'  @if($out_owner_type=='系统账户'){echo selected="selected";} @endif>系统账户</option>
        </select>
       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        转出者编号：
       <input type="text" style="width: 200px;height: 35px;" name="outpurseid" value="{{$out_purse_id or ''}}"/>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        转出者账户类型：
        <select name="outpursetype" style="width: 120px;">
          <option value=''>--请选择--</option>
          <option value='0_None' @if($outpursetype=='None'){echo selected="selected";} @endif>None</option>
          <option value='1_收益账户' @if($outpursetype=='收益账户'){echo selected="selected";} @endif>收益账户</option>
          <option value='2_现金账户' @if($outpursetype=='现金账户'){echo selected="selected";} @endif>现金账户</option>
          <option value='3_积分账户' @if($outpursetype=='积分账户'){echo selected="selected";} @endif>积分账户</option>
          <option value='4_o2o收益账户' @if($outpursetype=='o2o收益账户'){echo selected="selected";} @endif>o2o收益账户</option>
          <option value='96_过账账户' @if($outpursetype=='过账账户'){echo selected="selected";} @endif>过账账户</option>
          <option value='97_授信账户' @if($outpursetype=='授信账户'){echo selected="selected";} @endif>授信账户</option>
          <option value='98_中央银行账户' @if($outpursetype=='中央银行账户'){echo selected="selected";} @endif>中央银行账户</option>
          <option value='99_系统收益账户' @if($outpursetype=='系统收益账户'){echo selected="selected";} @endif>系统收益账户</option>
        </select>


          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

       <br/>
       转入者账户：
       <input type="text" style="width: 200px;height: 35px;" name="intoownerid" value="{{$into_owner_id or ''}}"/>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       
        转入者类型：
        <select name="into_owner_type" style="width: 120px;">
          <option value=''>--请选择--</option>
          <option value='0_None'  @if($into_owner_type=='None'){echo selected="selected";} @endif>None</option>
          <option value='1_用户账户'  @if($into_owner_type=='用户账户'){echo selected="selected";} @endif>用户账户</option>
          <option value='2_商家账户'  @if($into_owner_type=='商家账户'){echo selected="selected";} @endif>商家账户</option>
          <option value='3_企业账户'  @if($into_owner_type=='企业账户'){echo selected="selected";} @endif>企业账户</option>
          <option value='99_系统账户'  @if($into_owner_type=='系统账户'){echo selected="selected";} @endif>系统账户</option>
        </select>
       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        转入者编号：
       <input type="text" style="width: 200px;height: 35px;" name="intopurseid" value="{{$into_purse_id or ''}}"/>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        转入者账户类型：
        <select name="intopursetype" style="width: 120px;">
          <option value=''>--请选择--</option>
          <option value='0_None' @if($intopursetype=='None'){echo selected="selected";} @endif>None</option>
          <option value='1_收益账户' @if($intopursetype=='收益账户'){echo selected="selected";} @endif>收益账户</option>
          <option value='2_现金账户' @if($intopursetype=='现金账户'){echo selected="selected";} @endif>现金账户</option>
          <option value='3_积分账户' @if($intopursetype=='积分账户'){echo selected="selected";} @endif>积分账户</option>
          <option value='4_o2o收益账户' @if($intopursetype=='o2o收益账户'){echo selected="selected";} @endif>o2o收益账户</option>
          <option value='96_过账账户' @if($intopursetype=='过账账户'){echo selected="selected";} @endif>过账账户</option>
          <option value='97_授信账户' @if($intopursetype=='授信账户'){echo selected="selected";} @endif>授信账户</option>
          <option value='98_中央银行账户' @if($intopursetype=='中央银行账户'){echo selected="selected";} @endif>中央银行账户</option>
          <option value='99_系统收益账户' @if($intopursetype=='系统收益账户'){echo selected="selected";} @endif>系统收益账户</option>
        </select>


          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

         <br/>
          转账流水号：
       <input type="text" style="width: 200px;height: 35px;" name="transfer_id" value="{{$transfer_id or ''}}"/>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
         转账原因编码：
       <input type="text" style="width: 200px;height: 35px;" name="reason" value="{{$reason or ''}}"/>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <span class="text-c">
            <button name="" id="search" class="btn btn-success user_search" type="
            submit"><i class="Hui-iconfont"></i> 搜索</button>
            </span>
            <span class="r">共有数据：<strong>{{$data->total()}}</strong> 条</span>
        </div>
    </form>
      <!-- <div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"><a class="btn btn-primary radius" id="water_off">流水冲账</a></span> </div> -->
  </div>
  <form class="form-horizontal js-ajax-form" method="post" novalidate="novalidate">
    <table class="table table-hover table-bordered">
      <thead>
      <tr>
        <th>转账流水</th>
        <th>转出者编号</th>
        <th>转出者类型</th>
        <th>转出者账号</th>
        <th>转出者姓名</th>
        <th>转出者账户</th>
        <th>转出账户类型 </th>

        <th>转入者编号</th>
        <th>转入者类型</th>
        <th>转入者账号</th> 
        <th>转入者姓名 </th>
        <th>转入者账户 </th>
        <th>转入账户类型 </th>
        <th>转出金额  </th>
        <th>金额单位  </th>
        <th>原因编码 </th>
        <th>转账原因 </th>
        <th>转账状态 </th>
        <th>转账备注  </th>
        <th>转账时间 </th>
        <th>操作 </th>
      </tr>
      </thead>
      <tbody>
      @foreach($data as $val)
      <tr>
        <td>{{$val->transfer_id}}</td>
        <td>{{$val->out_purse_id}}</td>
        <td>
          @if($val->out_owner_type == 0)
              <span>None</span>
          @elseif($val->out_owner_type == 1)
              <span>用户账户</span>
          @elseif($val->out_owner_type == 2)
              <span>商家账户</span>
          @elseif($val->out_owner_type == 3)
              <span>企业账户</span>
          @else
              <span>系统账户</span>    
          @endif
        </td>
        <td>{{$val->out_nodecode}}</td>
        <td>{{$val->out_nodename}}</td>

        <td>{{$val->out_owner_id}}</td>
        <td>
          @if($val->outpursetype == 0)
              <span>None</span>
          @elseif($val->outpursetype == 1)
              <span>收益账户</span>
          @elseif($val->outpursetype == 2)
              <span>现金账户</span>
          @elseif($val->outpursetype == 3)
              <span>积分账户</span>
          @elseif($val->outpursetype == 4)
              <span>o2o收益账户</span>    
          @elseif($val->outpursetype == 96)
              <span>过账账户</span>    
          @elseif($val->outpursetype == 97)
              <span>授信账户</span>    
          @elseif($val->outpursetype == 98)
              <span>中央银行账户</span>            
          @else
              <span>系统收益账户</span>    
          @endif
        </td>

        <td>{{$val->into_purse_id}}</td>
         <td>
          @if($val->into_owner_type == 0)
              <span>None</span>
          @elseif($val->into_owner_type == 1)
              <span>用户账户</span>
          @elseif($val->into_owner_type == 2)
              <span>商家账户</span>
          @elseif($val->into_owner_type == 3)
              <span>企业账户</span>
          @else
              <span>系统账户</span>    
          @endif
        </td>

         <td>{{$val->into_nodecode}}</td>
         <td>{{$val->into_nodename}}</td>
         <td>{{$val->into_owner_id}}</td>
        <td>
          @if($val->intopursetype == 0)
              <span>None</span>
          @elseif($val->intopursetype == 1)
              <span>收益账户</span>
          @elseif($val->intopursetype == 2)
              <span>现金账户</span>
          @elseif($val->intopursetype == 3)
              <span>积分账户</span>
          @elseif($val->intopursetype == 4)
              <span>o2o收益账户</span>    
          @elseif($val->intopursetype == 96)
              <span>过账账户</span>    
          @elseif($val->intopursetype == 97)
              <span>授信账户</span>    
          @elseif($val->intopursetype == 98)
              <span>中央银行账户</span>            
          @else
              <span>系统收益账户</span>    
          @endif
        </td>

         <td><span style="color:red;">{{$val->out_amount}}</span></td>

         <td>{{$val->currency_unit}}</td>
         <td>{{$val->reason}}</td>
         <td>{{$val->reson_name}}</td>
         <td>
            @if($val->status == 0)
              <span>正常转账</span>
            @elseif($val->status == 1)
              <span>冲正记录</span>
            @else
              <span>已被冲正</span>
            @endif 
         </td>
         <td>{{$val->remarks}}</td>
         <td>{{$val->create_time}}</td>
         <td><span><a _id="{{$val->transfer_id}}" class="water_off">流水冲正</a></span></td>
       
      </tr>
      @endforeach
      </tbody>
    </table>

    <!-- 分页 -->
    @if (!empty($data))
    <div class="page_list">
        {{$data->links()}}
    </div>
    @endif
  </form>
</div>

<script>
$(function(){
   
    //流水冲账
    $('.water_off').click(function() {
      var id = $(this).attr('_id') || 0;
      open_iframe_layer('/capital/water_off?transfer_id='+id);
    });

    $('.js-rule-delete').click(function(){
    var id = $(this).attr('rel');
    layer.confirm('你确定要删除吗？', {
      btn: ['确定','取消']
    }, function(){
      $.post('{{asset("basiconfig/del")}}',{id:id},function (msg) {
        if(msg.status == 1){
          layer.alert(msg.info, {
            title: '提示',
            icon: 1,
          });
          window.location.href = '{{asset("basiconfig/transfer_rule")}}';
        }else{
          layer.alert(msg.info, {
            title: '提示',
            icon: 2,
          });
        }
      },'json');
    },function() {

    });
  });
});
//详情
// $('.apply_action').click(function() {
//   var id = $(this).attr('_id');
//    if(confirm("确定要审核通过吗？")){
//       $.ajax({
//             type: 'GET',
//             url: '/system/apply_action?id='+id,
//             dataType: 'json',
//             success: function(data){
               
//             },
           
//          });
//    }
        
//    });


</script>